/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jjsoft.celularessuc.gco.mdl;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author javila
 */
@Entity
@Table(catalog = "celularessuccom", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Detalletransferencia.findAll", query = "SELECT d FROM Detalletransferencia d"),
    @NamedQuery(name = "Detalletransferencia.findByIdDetalleTransferencia", query = "SELECT d FROM Detalletransferencia d WHERE d.idDetalleTransferencia = :idDetalleTransferencia"),
    @NamedQuery(name = "Detalletransferencia.findByCantidad", query = "SELECT d FROM Detalletransferencia d WHERE d.cantidad = :cantidad")})
public class Detalletransferencia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_detalle_transferencia", nullable = false)
    private Integer idDetalleTransferencia;
    private Integer cantidad;
    @JoinColumn(name = "id_transferencia", referencedColumnName = "id_transferencia")
    @ManyToOne(fetch = FetchType.EAGER)
    private Transferencia idTransferencia;
    @JoinColumn(name = "codigo_articulo", referencedColumnName = "codigo")
    @ManyToOne(fetch = FetchType.EAGER)
    private Articulo codigoArticulo;
    
    @Column(name="serie")
    private String serie;

    public Detalletransferencia() {
    }

    public Detalletransferencia(Integer idDetalleTransferencia) {
        this.idDetalleTransferencia = idDetalleTransferencia;
    }

    public Integer getIdDetalleTransferencia() {
        return idDetalleTransferencia;
    }

    public void setIdDetalleTransferencia(Integer idDetalleTransferencia) {
        this.idDetalleTransferencia = idDetalleTransferencia;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public String getSerie() {
        return serie;
    }

    public void setSerie(String serie) {
        this.serie = serie;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Transferencia getIdTransferencia() {
        return idTransferencia;
    }

    public void setIdTransferencia(Transferencia idTransferencia) {
        this.idTransferencia = idTransferencia;
    }

    public Articulo getCodigoArticulo() {
        return codigoArticulo;
    }

    public void setCodigoArticulo(Articulo codigoArticulo) {
        this.codigoArticulo = codigoArticulo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetalleTransferencia != null ? idDetalleTransferencia.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Detalletransferencia)) {
            return false;
        }
        Detalletransferencia other = (Detalletransferencia) object;
        if ((this.idDetalleTransferencia == null && other.idDetalleTransferencia != null) || (this.idDetalleTransferencia != null && !this.idDetalleTransferencia.equals(other.idDetalleTransferencia))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jjsoft.celularessuc.gco.mdl.Detalletransferencia[ idDetalleTransferencia=" + idDetalleTransferencia + " ]";
    }
    
}
